/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package view;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Mark
 */
@Entity
@Table(name = "admins", catalog = "ticketsaler", schema = "")
@NamedQueries({@NamedQuery(name = "Admins.findAll", query = "SELECT a FROM Admins a"), @NamedQuery(name = "Admins.findByAid", query = "SELECT a FROM Admins a WHERE a.aid = :aid"), @NamedQuery(name = "Admins.findByAname", query = "SELECT a FROM Admins a WHERE a.aname = :aname"), @NamedQuery(name = "Admins.findByApassword", query = "SELECT a FROM Admins a WHERE a.apassword = :apassword"), @NamedQuery(name = "Admins.findByAphone", query = "SELECT a FROM Admins a WHERE a.aphone = :aphone"), @NamedQuery(name = "Admins.findByAemail", query = "SELECT a FROM Admins a WHERE a.aemail = :aemail")})
public class Admins implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "AID")
    private Integer aid;
    @Basic(optional = false)
    @Column(name = "ANAME")
    private String aname;
    @Basic(optional = false)
    @Column(name = "APASSWORD")
    private String apassword;
    @Basic(optional = false)
    @Column(name = "APHONE")
    private int aphone;
    @Basic(optional = false)
    @Column(name = "AEMAIL")
    private String aemail;

    public Admins() {
    }

    public Admins(Integer aid) {
        this.aid = aid;
    }

    public Admins(Integer aid, String aname, String apassword, int aphone, String aemail) {
        this.aid = aid;
        this.aname = aname;
        this.apassword = apassword;
        this.aphone = aphone;
        this.aemail = aemail;
    }

    public Integer getAid() {
        return aid;
    }

    public void setAid(Integer aid) {
        Integer oldAid = this.aid;
        this.aid = aid;
        changeSupport.firePropertyChange("aid", oldAid, aid);
    }

    public String getAname() {
        return aname;
    }

    public void setAname(String aname) {
        String oldAname = this.aname;
        this.aname = aname;
        changeSupport.firePropertyChange("aname", oldAname, aname);
    }

    public String getApassword() {
        return apassword;
    }

    public void setApassword(String apassword) {
        String oldApassword = this.apassword;
        this.apassword = apassword;
        changeSupport.firePropertyChange("apassword", oldApassword, apassword);
    }

    public int getAphone() {
        return aphone;
    }

    public void setAphone(int aphone) {
        int oldAphone = this.aphone;
        this.aphone = aphone;
        changeSupport.firePropertyChange("aphone", oldAphone, aphone);
    }

    public String getAemail() {
        return aemail;
    }

    public void setAemail(String aemail) {
        String oldAemail = this.aemail;
        this.aemail = aemail;
        changeSupport.firePropertyChange("aemail", oldAemail, aemail);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (aid != null ? aid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Admins)) {
            return false;
        }
        Admins other = (Admins) object;
        if ((this.aid == null && other.aid != null) || (this.aid != null && !this.aid.equals(other.aid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "view.Admins[aid=" + aid + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
